package com.onesports.intelligent.k12.polarlight.domain.dto.sys;

import com.onesports.intelligent.k12.polarlight.common.constant.Constants;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.time.Instant;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserDTO {

    private String id;

    @ApiModelProperty(value = "登录名称", name = "login", required = true)
    @Pattern(regexp = Constants.LOGIN_REGEX)
    @Size(min = 1, max = 50)
    private String login;

    @Size(max = 50)
    @ApiModelProperty(value = "姓", name = "firstName")
    private String firstName;

    @Size(max = 50)
    @ApiModelProperty(value = "名", name = "lastName")
    private String lastName;

    @Email
    @Size(min = 5, max = 254)
    @ApiModelProperty(value = "邮箱", name = "email", required = true)
    private String email;

    @Size(min = 1, max = 1)
    @ApiModelProperty(value = "性别", name = "sex")
    private String sex;

    private String createdBy;
    private Instant createdDate;
    private String lastModifiedBy;
    private Instant lastModifiedDate;

    //public UserDTO(User user) {
    //    this.id = user.getId();
    //    this.login = user.getLogin();
    //    this.firstName = user.getFirstName();
    //    this.lastName = user.getLastName();
    //    this.email = user.getEmail();
    //    this.sex = user.getSex();
    //    this.createdBy = user.getCreatedBy();
    //    this.createdDate = user.getCreatedDate();
    //    this.lastModifiedBy = user.getLastModifiedBy();
    //    this.lastModifiedDate = user.getLastModifiedDate();
    //}
}
